<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>管理员-用户订单详情</title>
    <meta name="viewport" content="width=device-width, initial-scale=1,maximum-scale=1,user-scalable=no">
    <meta name="apple-mobile-web-app-capable" content="yes">
    <meta name="apple-mobile-web-app-status-bar-style" content="black">
    <!--标准mui.css-->
    <link rel="stylesheet" href="../css/mui.min.css">

    <!--App自定义的css-->
    <!--<link rel="stylesheet" type="text/css" href="../css/app.css"/>-->
    <style>
        li{ list-style:none; }
        .mui-input-row label{width: 100%;font-size: 15px;}
        .mui-input-group .mui-input-row{
            height: 32px;
        }
        label{
            font-size: 12px!important;
        }
    </style>

</head>
<body>
<div class="mui-content" >            
    <form class="mui-input-group" style="margin-top: 0px;">
        <div class="mui-input-row ">
            <label >订单编号：<span id="oredid"></span></label>
        </div>
        <div class="mui-input-row ">
            <label style="">下单时间：<span id="time"></span></label>
        </div>
        <div class="mui-input-row ">
            <label style="float: right!important;">订单状态：<span id="oredtype" ></span></label>
        </div>
        <div class="mui-input-row ">
            <label>下单金额：<span id="hetongmoney"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>下单客户：<span id="username"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>联系电话：<span id="phone"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>详细地址：<span id="address"></span></label>
        </div>
    </form>
    <form class="mui-input-group" style="margin-top: 10px;margin-bottom: 10px;" id="agenttxt">
        <div class="mui-input-row ">
            <label >经纪人姓名：<span id="upusername"></span></label>
        </div>
        <div class="mui-input-row ">
            <label style="">协助状态：<span id="assitanttype"></span></label>
        </div>
        <div class="mui-input-row ">
            <label>协助姓名：<span id="assitant"></span></label>
        </div>
        <div class="mui-input-row ">
            <label >合同差价：<span id="totalprice"></span></label>
        </div>
        <div class="mui-input-row ">
            <label style="">杂费金额：<span id="zafei"></span></label>
        </div>
        <div class="mui-input-row " style="height: 50px;">
            <label>杂费明细：<span id="zafeimingxi"></span></label>
        </div>
        <div class="mui-input-row " style="height: 70px;">
            <label>经纪人佣金：<span id="jjrmoney"></span></label>
        </div>
        <div class="mui-input-row "style="height: 70px;">
            <label>协助人佣金：<span id="xzrmoney"></span></label>
        </div>
        <div class="mui-input-row " style="height: 70px;">
            <label>上级经纪人红利：<span id="upusermoney"></span></label>
        </div>
    </form>
    <form class="mui-input-group" style="margin-top: 10px;margin-bottom: 50px;">
        <div class="mui-input-row " style="height: 650px;" id="qbq">
            <label>祛斑前：</label>
            <img src="" id="img0" style="width: 50%;height: 190px;margin-left: 30%">
            <img src="" id="img1" style="width: 50%;height: 190px;margin-left: 30%">
            <img src="" id="img2" style="width: 50%;height: 190px;margin-left: 30%">
        </div>
        <div class="mui-input-row " style="height: 240px;" id="ht">
            <label>合同照片：</label>
            <img src="" id="img6" style="width: 50%;height: 190px;margin-left: 30%">
        </div>
        <div class="mui-input-row " style="height: 650px;" id="qbh">
            <label>祛斑后：</label>
            <img src="" id="img3" style="width: 50%;height: 190px;margin-left: 30%">
            <img src="" id="img4" style="width: 50%;height: 190px;margin-left: 30%">
            <img src="" id="img5" style="width: 50%;height: 190px;margin-left: 30%">
        </div>
        <div class="mui-input-row " style="height: 40px;" id="butn">
            <a  href="JavaScript:save()"class="mui-btn mui-btn-primary" style="height: 30px;margin-top: 5px;color: #FFF;float: right;width: 100%">通过</a>
        </div>
    </form>
    <div class="footerpage">
    </div>
</div>

</body>

<script src="../js/mui.min.js"></script>
<script src="../js/practise/push.js"></script>
<script src="../js/jquery.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../js/getUrlParam.js"></script>
<script src="../js/cookieutil.js" type="text/javascript" charset="utf-8"></script>
<script>
    var id=getUrlParam("id");
    function save(){
        var dataobj={
            id:id,
            status:5
        }
        mui.post('/Order/ordecomplete',
            dataobj,
            function(data) {
                if (data.object>0)
                {
                    mui.toast('提交成功！');
                    window.location.reload();
                }
            },'json'
        )
    }
    function getUpuser(obj,orderid){
        mui.post('/User/findByid',
            {
                id:obj
            },
            function(data){
                console.log(data);
                if (data.code&&data.object!=null){
                    var  item=data.object;

                    findByUserid(item.upopenid,orderid,2,4);

                }
            },'json'
        );
    }

    function findByUserid(userid,orderid,type,types) {
        var dataobj = {
            userid: userid,
            orderid: orderid,
            type: types
        }
        mui.post('/Salary/findByUserid',
            dataobj,
            function (data) {
                console.log(data);
                if (data.code) {
                    for (var i = 0; i < data.object.length; i++) {
                        if (data.object[i].type == 0) {
                            var jjrmoney = document.getElementById("jjrmoney");
                            jjrmoney.innerHTML = data.object[i].nickname + "&nbsp;&nbsp;&nbsp;&nbsp" + data.object[i].money + "元" + "&nbsp;&nbsp;&nbsp;&nbsp;订单号：" + data.object[i].orderid + "<br>时间：" + data.object[i].createtime;//改变内容
                        }
                        if (data.object[i].type == 1) {
                            var xzrmoney = document.getElementById("xzrmoney");
                            xzrmoney.innerHTML = data.object[i].nickname + "&nbsp;&nbsp;&nbsp;&nbsp" + data.object[i].money + "元" + "&nbsp;&nbsp;&nbsp;&nbsp;订单号：" + data.object[i].orderid + "<br>时间：" + data.object[i].createtime;//改变内容
                        }
                        if (data.object[i].type == 4) {

                            var upusermoney = document.getElementById("upusermoney");
                            upusermoney.innerHTML = data.object[i].nickname + "&nbsp;&nbsp;&nbsp;&nbsp" + data.object[i].money + "元" + "&nbsp;&nbsp;&nbsp;&nbsp;订单号：" + data.object[i].orderid + "<br>时间：" + data.object[i].createtime;//改变内容
                        }
                    }
                }

            }, 'json'
        )
    }


    $(function(){
        /*公共部分
         * 导航栏
         * footer CopyRight
         */
        if (id==undefined){ mui.toast('请求错误id为空');return;}
        var upopenid=getUrlParam("upopenid");
        if(upopenid==undefined){upopenid=="";}
        mui.post('/Order/findOredId',
            {
                id:id
            },
            function(data){
                console.log(data);

                if (data.code&&data.object!=null){
                    var  item=data.object;
                    if (item.typedata=='0')
                    {

                        document.getElementById("agenttxt").style.display="none";
                    }

                    var oredid = document.getElementById("oredid");
                    oredid.innerHTML =item.id;//改变内容

                    var time = document.getElementById("time");
                    time.innerHTML =formattime(item.createtime);//改变内容

                    var oredtype = document.getElementById("oredtype");
                    oredtype.innerHTML =getstatustype(item.statustype);//改变内容
                    if (item.statustype!=4)
                    {

                        var divshow = document.getElementById("butn");
                        divshow.style.display="none";
                    }
                    var hetongmoney = document.getElementById("hetongmoney");
                    hetongmoney.innerHTML =item.hetongmoney;//改变内容

                    var username = document.getElementById("username");
                    username.innerHTML =item.username;//改变内容

                    var phone = document.getElementById("phone");
                    phone.innerHTML =item.phone;//改变内容


                    var address = document.getElementById("address");
                    address.innerHTML =item.address;//改变内容

                    var upusername = document.getElementById("upusername");
                    upusername.innerHTML =item.upusername;//改变内容
                    findByUserid(item.upuserid,id,0,0);
                    // getUpuser(item.upuserid,id);
                    var assitant = document.getElementById("assitant");
                    var assitanttype = document.getElementById("assitanttype");

                    if (item.isassitant)
                    {   assitanttype.innerHTML="已申请协助";
                        // findByUserid(item.assitantid,id,1,1);
                    }
                    else {
                        assitanttype.innerHTML="";
                    }
                    if(item.assitant==""||item.assitant==undefined||item.assitant==null){
                        assitant.innerHTML ="";//改变内容
                    }
                    else {
                        assitant.innerHTML =item.assitant;//改变内容

                    }
                    var totalprice = document.getElementById("totalprice");
                    totalprice.innerHTML =item.totalprice;//改变内容

                    var zafeimingxi = document.getElementById("zafeimingxi");
                    zafeimingxi.innerHTML =item.zafeimingxi;//改变内容

                    var zafei = document.getElementById("zafei");
                    zafei.innerHTML =item.zafei;//改变内容

                    if (item.preimages.length>0) {
                        var arr = item.preimages.split(",");
                        for (var i = 0; i < arr.length; i++) {
                            document.getElementById("img" + i).src = imgsrcpath() + arr[i];
                        }
                    }
                    else {
                        document.getElementById("qbq").style.display="none";
                    }

                    if (item.hetongimages.length>0)
                    {
                        document.getElementById("img6").src=imgsrcpath()+item.hetongimages;
                    }  else {
                        document.getElementById("ht").style.display="none";
                    }


                    if (item.afterimages!=""&&item.afterimages!=undefined&&item.afterimages!=null) {
                        var arr2=item.afterimages.split(",");
                        for (var i = 0; i < arr2.length; i++) {
                            var k=3+i;
                            document.getElementById("img" +k).src = imgsrcpath() + arr2[i];
                        }
                    }
                    else {
                        document.getElementById("qbh").style.display="none";
                    }
                }
            },'json'
        );
    });
    $(".headage").load("head.html");
    $(".footerpage").load("footer.html");
</script>
</html>